#include<vector>
#include<algorithm>
using namespace std;
class Solution 
{
public:
    vector<int> twoSum(vector<int>& price, int target) 
    {
        sort(price.begin(),price.end());
        int l=0,r=price.size()-1;
        vector<int>ans;
        while(l<=r)
        {
            if(price[l]+price[r]==target)
            {
                ans.push_back(price[l]);
                
                ans.push_back(price[r]);
                return ans;

            }
            else if(price[l]+price[r]<target)
            {
                l++;
            }
            else 
            {
                r--;
            }
        }
        return ans;
    }
};